/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package com.srcptit.trainning.giangnd.btvn1;

import java.util.Scanner;

/**
 *
 * @author GIANG
 */
public class B2 {
    static int UCLN(int a, int b) {
		int t;
		while (b != 0) {
			t = a % b;
			a = b;
			b = t;
		}
		return a;
	}

	public static void main(String args[]) {
        try (Scanner sc = new Scanner(System.in)) {
            int a, b;
            System.out.println("a=");
            a = sc.nextInt();
            System.out.println("b=");
            b = sc.nextInt();
            System.out.println("UCLN cua " + a + " va " + b + " = " + UCLN(a, b));
        }
	}

}
